package com.zzh.myapplication.datedialog;

import android.app.ActionBar;
import android.content.Context;
import android.view.MotionEvent;
import android.view.View;
import android.widget.PopupWindow;

/**
 * Created by Administrator on 2016/3/21.
 */
public class ShowPopeWindow {
    public PopupWindow popuwindow;
    public View view;

    public void ShowPopuWindow(Context context, View v, int m) {
        view = View.inflate(context, m, null);
        popuwindow = new PopupWindow();
        popuwindow.setWidth(ActionBar.LayoutParams.MATCH_PARENT);
        popuwindow.setHeight(ActionBar.LayoutParams.MATCH_PARENT);
        popuwindow.setContentView(view);
        popuwindow.setFocusable(true);//设置焦点
        popuwindow.setOutsideTouchable(true);
        //popuwindow.setBackgroundDrawable(getResources().getDrawable(R.mipmap.icon_id_card));
        popuwindow.showAsDropDown(v);


        view.setOnTouchListener(new View.OnTouchListener() {
            @Override
            public boolean onTouch(View v, MotionEvent event) {
                popuwindow.dismiss();
                return true;
            }
        });
    }


}
